package com.demo.zyt.modules.app.service.impl;


import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.demo.zyt.common.dto.majorplan.MajorPlanDTO;
import com.demo.zyt.common.dto.majorplan.MajorPlanSubjectDTO;
import com.demo.zyt.common.utils.PageUtils;
import com.demo.zyt.common.utils.Query;
import com.demo.zyt.modules.app.dao.MajorPlanDao;
import com.demo.zyt.modules.app.entity.MajorPlanEntity;
import com.demo.zyt.modules.app.service.MajorPlanService;


@Service("majorPlanService")
public class MajorPlanServiceImpl extends ServiceImpl<MajorPlanDao, MajorPlanEntity> implements MajorPlanService {

	@Override
	public PageUtils queryByCondition(Map<String, Object> params) {
		
		Page<MajorPlanDTO> page = new Query<MajorPlanDTO>(params).getPage();
		
		List<MajorPlanDTO> majorPlanDTOs = this.baseMapper.queryByCondition(page, params);
		
		majorPlanDTOs.forEach(item -> {
			item.setSchoolImage("http://www.gaokaozyt.cn/images/" + item.getCollegeId()+ "/headImage.jpg");
		});
		
        page.setRecords(majorPlanDTOs);
        
        return new PageUtils<MajorPlanDTO>(page);
	}

	@Override
	public Integer querySchoolCountByCondition(Map<String, Object> params) {
		
		return this.baseMapper.querySchoolCountByCondition(params);
		
	}
	
	
	
}
